<style>
.content-group {background:#fff;border-radius: 0.5rem;margin-bottom:0.39rem}
.merchname {display:none}
.fui-tab-scroll .item a {color:#fff;font-weight:400}
.fui-tab-scroll .item.on,.fui-tab-scroll .item.on a{color:#fff;}
.fui-tab-scroll .item.on:before {background:linear-gradient(to right,rgba(255,255,255,1),rgba(255,255,255,0));}
.fui-icon-group .fui-icon-col {
    margin: 0.1rem 0;
}
.carousel {margin-top:0}
.fui-header:after {
	border-bottom: 0 solid #D9D9D9;
}
.fui-notice:after, .fui-notice:before  {
	border-bottom: 0 solid #D9D9D9;
	border-top: 0 solid #D9D9D9;
}
.bottombg {position: absolute;width:100%;height:3.5rem;border-bottom-right-radius:100% 10rem;border-bottom-left-radius:100% 1rem;}
</style>
<div ng-include="sys_html('common/_header','','','jy_weishop')"></div>
<div ng-if="pagedata.nodatapic_close" class="fui-page fui-page-current page-goods-list">
<div class='fui-content' style="top:0">
	<div class="topbg" style="position: relative;text-align:center;width:100%;height:4.5rem;background: {{main.syscolor || '#7c1cc9'}};">
		<div class="fui-header" style="background:none">
			<div class="fui-header-left" style="padding-left:0.5rem">
				<img style="height:1.2rem" ng-src="{{tomedia(pagedata.setting.toplogo) || '../addons/jy_weishop/resource/images/logo.png'}}"/>
			</div>
			<div class="title"></div>
			<div class="fui-header-right" style="padding-right:0.5rem;color:#fff">
				<i class="icon jinyunicon icon-fenxiang2" onclick="$('#showsharecover').modal();" style="font-size: 1rem;margin-right:10px"></i>
				<i class="icon jinyunicon icon-liaotian" ng-click="access_json('jy_weishop/member.index/')" style="font-size: 1rem;"></i>
			</div>
		</div>
		<div class="fui-searchbar bar" style="background:none;z-index: 0;top:2rem">
				<div ng-class="{'searchbar':1,'searchbar-active':pagedata.searchbar ==1}" style="background:none">
						<div style="position: relative;left:0;top:0;">
							<div class="search-input" style="height:1.6rem">
								<i id="searchsub" class="icon icon-sousuo1" ng-click="access_json('jy_weishop/goods.index//keyword='+pagedata.params.keyword)" style="line-height: 1.7rem;"></i>
								<input type="search" placeholder="搜索商品" class="search" ng-model="pagedata.params.keyword" style="height:1.6rem;text-align: left; color: #999; font-size:0.6rem;background:#f9f9f9;border-radius: 1rem;" />
							</div>
						</div>
				</div>
		</div>
	</div>
	<div class="fui-tab-scroll" ng-if="pagedata.p_group.length>0" style="background: {{main.syscolor || '#7c1cc9'}};">
		<div ng-class="{'item':1,'on':pagedata.params.pid==0}" style="height:2rem;line-height:1.5rem"><a href="javascript:;" ng-click="pagedata.params.pid=0;tool.get_list('jy_weishop/goods.index/getlist/order=ishot',true)">首页</a></div>
		<div ng-repeat="tab in pagedata.p_group" style="height:2rem;line-height:1.5rem" ng-class="{'item':1,'on':pagedata.params.pid==tab.id}"><a href="javascript:;" ng-click="pagedata.params.pid=tab.id;pagedata.params.cid=0;pagedata.groupkey=$index;tool.get_list('jy_weishop/goods.index/getlist/pcate='+tab.id,true)">{{tab.title}}</a></div>
		<div ng-if="!pagedata.p_group || pagedata.p_group.length<1" ng-class="{'item':1,'on':pagedata.params.pid==-1}" style="height:2rem;line-height:1.5rem"><a href="javascript:;" ng-click="pagedata.params.pid=-1;pagedata.params.cid=0;pagedata.groupkey=$index;tool.get_list('jy_weishop/goods.index/getlist/',true)">其他商品</a></div>
	</div>
	<div class="bottombg" style="background:{{main.syscolor || '#7c1cc9'}};"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.ishdps" ng-include="sys_html('shop/_hdps','','','jy_weishop')" class="radius" style="padding:0 0.5rem;"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isswiper" style="padding: 0.3rem;width:100%">
		<div class="bgnone" ng-include="sys_html('shop/_swiper','','','jy_weishop')"></div>
	</div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isbankuai1" class="radius" style="padding: 0.3rem;width:100%">
		<div class="bgnone" ng-include="sys_html('shop/_bankuai1','','','jy_weishop')"></div>
	</div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isnotice" ng-include="sys_html('shop/_notice','','','jy_weishop')" class="radius" style="padding:0 0.5rem;"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.iscoupon" ng-include="sys_html('shop/_coupon','','','jy_weishop')" class="orange" style="padding:0 0.3rem;margin-top:0.2rem"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.islivebankuai" ng-include="sys_html('shop/_livebankuai','','','jy_weishop')" class="radius" style="padding:0 0.5rem;margin-top:-0.2rem;"></div>
	<div ng-if="pagedata.params.pid!=0 && pagedata.p_group[pagedata.groupkey].c_group.length>0" style="padding: 0.3rem;width:100%">
		<div class="fui-icon-group noborder col-5 radius"  style="padding-top:0.3rem;background: #ffffff">
			   <div class="fui-icon-col external" ng-repeat="item in pagedata.p_group[pagedata.groupkey].c_group" style="margin:0" ng-click="pagedata.params.cid=item.id;tool.get_list('jy_weishop/goods.index/getlist/ccate='+item.id,true)">
					<div class="badge" style="background-color: #f60;"></div>
					<div class="icon icon-green radius" style="height:36px;line-height:36px"><img style="width:36px;height:36px" ng-src="{{tomedia(item.image) || '../core/resource/images/diy/icon/icon_goods.png'}}"/></div>
					<div class="text" style="font-size:0.55rem;">{{item.title}}</div>
			   </div>
		</div>
	</div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isnewgoods" class="radius bgfff" style="padding-top:0.2rem" ng-include="sys_html('shop/_newgoods','','','jy_weishop')"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.islikegoods" class="radius" ng-include="sys_html('shop/_likegoods','','','jy_weishop')"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isrecommand" class="radius bgfff" ng-include="sys_html('shop/_recommand','','','jy_weishop')"></div>
	<div style="margin-top:-0.2rem;padding:0 0.3rem" ng-include="sys_html('shop/_goodstwo','','','jy_weishop')"></div>
</div>
</div>
<div ng-include="sys_html('common/_share','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_sales','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_menu','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_footer','','','jy_weishop')"></div>
<div ng-if="pagedata.nodatapic_close" ng-include="sys_html('common/_coupon',true)"></div>
<div ng-if="pagedata.nodatapic_close" ng-include="sys_html('common/_h5game',true)"></div>
<div ng-include="sys_html('common/_gotop',true)"></div>
<!--弹目-->
<div ng-if="pagedata.showtanmus && !pagedata.pluginset.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" ng-src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>
<script>
scope.pagedata.setting.issearch=1
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.isno_coupontop=1;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.pagedata.nowmsgid=0;
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('index');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.setting.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.setting.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='index'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
// 百度地图API功能
if(!scope.pagedata.lat_lng){
	window.scope.location(function(re){
		if(re.lat_lng){
			scope.get('jy_weishop/store.index/getlist/islocation=1&lat='+re.lat_lng.lat+'&lng='+re.lat_lng.lng,function(res){
						scope.pagedata.selectstore = res.stores?res.stores[0]:{};
						scope.$evalAsync();
			});
		}
	});
}
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
</script>